<template>
  <div class="page">
    <el-pagination
      :current-page="searchValue.page"
      :page-sizes="[10, 30, 70, 100]"
      :page-size="searchValue.limit"
      background
      layout="total, sizes, prev, pager, next, jumper"
      :total="count"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
    />
  </div>
</template>

<script>
export default {
  props: {
    searchValue: {
      type: Object,
      default: () => {}
    },
    count: {
      type: Number,
      default: 1
    },
    onSearch: {
      type: Function,
      default: () => { }
    }
  },
  methods: {
    // 每页显示多少条
    handleSizeChange(val) {
      this.searchValue.limit = val
      this.searchValue.page = 1
      // 重新调用请求
      this.onSearch()
    },
    // 当前页是
    handleCurrentChange(val) {
      this.searchValue.page = val
      // 重新调用请求
      this.onSearch()
    }
  }
}
</script>

<style>

</style>
